package com.byedu.course.controller;

import com.byedu.course.WeiXinUserService;
import com.byedu.domain.course.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/user")
public class WeiXinUserController {

    @Autowired
    private WeiXinUserService weiXinUserService;


    /**
     * 用户用微信账号登录
     *
     * @param userId
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getuserbyuid/{userId}", method = {RequestMethod.GET})
    public WeiXinUserVO getUserInfobyUserid(@PathVariable String userId) {

        return weiXinUserService.getWeiXinUserVOByUserId(userId);
    }

    /**
     * 用户用微信账号登录
     *
     * @param openId
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/getuserbyopenid/{openId}", method = {RequestMethod.GET})
    public WeiXinUserVO getUserInfobyOpenId(@PathVariable String openId) {
        return weiXinUserService.getWeiXinUserVOByOpenId(openId);
    }
}
